<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function find(text)
        {
             text = text.toLowerCase();
             text = text.match(/\b\w+\b/g);
             let maxCount = 0;
             let keyWord = '';
             let map = new Map();
             text.forEach(item=>{
                if(!map[item])
                {
                    map[item] = 0;
                    map[item]++;
                }
                else
                {
                    map[item]++;
                }

                if(map[item]>maxCount)
                {
                    maxCount = map[item];
                    keyWord = item;
                }
             })

             return keyWord;
        }

        let text = "我是小黄鹂  我是狗 我是狗  我是狗 qbqbqbqb abc abc abc";
        console.log(find(text));
    </script>
</body>
</html>